home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / sys / amiga / programmer / 3404 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  3.5 KB

  1. X-Mailer: MicroDot 1.10 [UNREGISTRIERT] via [DOS/NCBMail V2.21 REL.:160995]
  2. Message-ID: <xJSEnMD0aez4@point86.people-s.people.de>
  3. Organization: Artwork Demo Factories ..
  4. References: <38232371@kone.fipnet.fi> <38232442@kone.fipnet.fi>
  5. X-Gateway: ZCONNECT UU people-s.people.de [DUUCP vom 01.07.1994]
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=ISO-8859-1
  8. Content-Transfer-Encoding: 8bit
  9. From: azure@people-s.people.de (Tim Boescke)
  10. Subject: Re: TMapping again!
  11. Date: 16 Feb 1996 23:28:23 +0100
  12. Path: people-s.people.de!azure
  13. Newsgroups: comp.sys.amiga.programmer
  14. Distribution: world
  15.  
  16. jsaarinen@kone.fipnet.fi (Jyrki Saarinen) erzeugte am 13.02.1996 unter dem
  17. Betreff "Re: TMapping again!" :
  18.  
  19.  
  20. JS> > A ultraoptimized texturemapper uese no shading table.
  21. JS> > even add-shading slows mapping down.
  22. JS> > 
  23. JS> > Imgagine 32 colors, each 8 shading-steps = 256 colors.
  24. JS> 
  25. JS> Yep. But how do you expect that a game for example can
  26. JS> be made with n-1 textures, all sharing the same 32c palette?
  27. JS> 
  28. JS> > move.w d1,d6
  29. JS> > move.b d0,d6
  30. JS> > move.l d6,a0
  31. JS> > move.b (a0),d7
  32. JS> > sub.b d5,d7       ;another 2 cycles
  33. JS> > move.b d7,(a1)+   ;another 2 cycles
  34. JS> > 
  35. JS> > addx.l d2,d0 ;x
  36. JS> > addx.l d3,d1 ;y
  37. JS> > addx.l d4,d5 ;gouraud-alike color. ;another 2 cycles
  38. JS> 
  39. JS> Your sub.b d5,d7 trashs the X-flag .. better use or.b.
  40. JS> 
  41. JS> > no reg left for dbra loop. 2 more cycles in unrolled loop.
  42. JS> > 
  43. JS> > in inner-loop another 6 additional cycles compared to 
  44. JS> > nonshaded mapping. +30%.
  45. JS> 
  46. JS> Hmm. I made once a mapper with 16c and 16 shades, all fitted
  47. JS> to registers, add.l an,ax was used for V interpolation though,
  48. JS> only 8 bits of fraction in V.
  49. JS> 
  50. JS> > I guess with table it's more like +70%.
  51. JS> 
  52. JS> Well. How many cycles the optimal mapper was?
  53. JS> 
  54. JS>         move.w  d1,d0
  55. JS>         move.b  d2,d0
  56. JS>         addx.l  d3,d1
  57. JS>         move.l  d0,a0
  58. JS>         addx.l  d4,d2
  59. JS>         move.b  (a0),(a1)+
  60. JS> 
  61. JS> That is 17 cycles .. now, my Texture/Gouraud loop with
  62. JS> a shading table, 256c and up to 256 shades is 30 020/030
  63. JS> cycles, calculated the same way like that 17 cycles.
  64. JS> 
  65. JS> ~76% slower .. Quite a good guess.
  66.  
  67.     A time ago I did an approach to this problem using a similar trick
  68.     than my two-command mapper.
  69.     (btw. actually this one WORKS .. I have tried it out)
  70.  
  71.  
  72.         move.l  d3,d2           ;d3=d4=0000000000000XXXXXXXxxxxxxYYYYYY
  73.         move    d0,d5           ;d0=a6=yyyyyyyy000000000000BBBBBBbbbbbb
  74.         and.l   d6,d2           ;d6=   00000000000001111111000000111111
  75.         and.b   d7,d5           ;d7=   xxxxxxxxxxxxxxxxxxxxxxxx11000000
  76.         or      d5,d2
  77.         move.b  (a4,d2.l),(a2)+ ;d2=   00000000000000xxxxxxbbbbbbyyyyyy
  78.         add.l   a6,d0
  79.         addx.l  d4,d3
  80.  
  81.      This one is doing Texturemapping + gouraud shading with
  82.      shadetable. (!!)
  83.  
  84.      The Texture is 64x64 (6 bit) and the shading is 6 bit two. You
  85.      will need a 256k combined Texture/Shading table.
  86.  
  87.      The Routine byself was a bit slower than ordenary Texturemapping.
  88.      But should be a lot fast than to memery-accesses. And it uses only
  89.      two adds..
  90.  
  91.      Speed could still be improved by aligned the table to a 256k border.
  92.  
  93. JS> --                               _
  94. JS> a Stellar programmer          _ //
  95. JS> "Amiga - back for the future" \X/
  96.  
  97. --
  98.     +--------------------------------------------------------------------+
  99.     |      -  AZURE@PEOPLE-S.people.de - Tim Boescke - AZURE /atw.bzr    |
  100.     +------------------<programming on:AMIGA,PC,C64,PLUS/4,VCS2600>------+
  101.